package com.cskaoyan.service.wx.home;

import com.cskaoyan.bean.wx.home.WXBrand;
import com.cskaoyan.bean.wx.home.WXBrandExample;
import com.cskaoyan.bean.wx.home.vo.BrandVo;
import com.cskaoyan.mapper.home.WXBrandMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * 创建日期: 2022/05/08 12:35
 *
 * @author JinLu Zhou
 */
@Service
public class WXBrandServiceImpl implements WXBrandService {
    @Autowired
    WXBrandMapper wxBrandMapper;

    @Override
    public List<BrandVo> queryAllBrand() {
        WXBrandExample wxBrandExample = new WXBrandExample();
        WXBrandExample.Criteria criteria = wxBrandExample.createCriteria();
        criteria.andDeletedEqualTo(false);
        List<WXBrand> wxBrands = wxBrandMapper.selectByExample(wxBrandExample);
        ArrayList<BrandVo> brandVos = new ArrayList<>();
        for (WXBrand wxBrand : wxBrands) {
            BrandVo brandVo = new BrandVo();
            brandVo.set(wxBrand);
            brandVos.add(brandVo);
        }
        return brandVos;
    }
}
